]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
AppDisplay: fake a release event to dnd when opening the menu
authorGiovanni Campagna <gcampagna@src.gnome.org>
Wed, 20 Feb 2013 15:55:02 +0000 (16:55 +0100)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Wed, 20 Feb 2013 16:01:25 +0000 (17:01 +0100)
PopupMenuManager eats the next release event, which would otherwise close
the menu, so we need to tell dnd that we're handling it, and no drag should
be started, so it can ungrab the pointer and restore state.

https://bugzilla.gnome.org/show_bug.cgi?id=694276

js/ui/appDisplay.js
js/ui/dnd.js

index c247189eb9669fe3ee3cc3c4dc40bc713b1fe295..461145b2b62b2fe48ff4d34af87af58170b2afdb 100644 (file)
@@ -790,6 +790,7 @@ const AppIcon = new Lang.Class({
     popupMenu: function() {
         this._removeMenuTimeout();
         this.actor.fake_release();
+        this._draggable.fakeRelease();
 
         if (!this._menu) {
             this._menu = new AppIconMenu(this);
index f7d6f1a989b0ac5fc029915c565296017284ddbb..f8eecd381bf51ebcd811c3e9686e50653faac673 100644 (file)
@@ -136,9 +136,10 @@ const _Draggable = new Lang.Class({
     },
 
     _ungrabActor: function() {
-        Clutter.ungrab_pointer();
         if (!this._onEventId)
             return;
+
+        Clutter.ungrab_pointer();
         this.actor.disconnect(this._onEventId);
         this._onEventId = null;
     },
@@ -203,6 +204,19 @@ const _Draggable = new Lang.Class({
         return false;
     },
 
+    /**
+     * fakeRelease:
+     *
+     * Fake a release event.
+     * Must be called if you want to intercept release events on draggable
+     * actors for other purposes (for example if you're using
+     * PopupMenu.ignoreRelease())
+     */
+    fakeRelease: function() {
+        this._buttonDown = false;
+        this._ungrabActor();
+    },
+
     /**
      * startDrag:
      * @stageX: X coordinate of event